import Vue from 'vue'
import VueI18n from 'vue-i18n'//引入vue-i18n
import { getLang } from '@/utils/lang'//设置语言包cookie; 下面有配置
import elementEnLocale from 'element-ui/lib/locale/lang/en'//elementui英文
import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN'//elementui中文
import enLocale from './en'
import zhLocale from './zh'

Vue.use(VueI18n)

const messages = {
    en: {
        ...enLocale,
        ...elementEnLocale
    },
    zh: {
        ...zhLocale,
        ...elementZhLocale
    }
}

const i18n = new VueI18n({
    locale: getLang() || 'zh',
    messages,
    silentTranslationWarn: true//取消警告
})

export default i18n
